﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
             xmlns:ViewModel="clr-namespace:HelpDesk.ViewModel"
             xmlns:local="clr-namespace:HelpDesk.UserControls"
             x:Class="HelpDesk.UserControls.UsersView"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="900"
             Unloaded="UserControl_Unloaded" d:DataContext="{d:DesignData /SampleData/UsersViewViewModelSampleData.xaml}" >
    <UserControl.DataContext>
        <ViewModel:UsersViewViewModel />
    </UserControl.DataContext>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="122" />
            <ColumnDefinition Width="71*" />
            <ColumnDefinition Width="18*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="254*" />
        </Grid.RowDefinitions>
        <ListBox x:Name="listBox"
                 ItemsSource="{Binding UsersRemoteSoftware}"
                 IsSynchronizedWithCurrentItem="True"
                 Grid.Row="2"
                 Grid.ColumnSpan="3"
                 Margin="0,5,0,2.04"
                 dd:DragDrop.IsDragSource="True"
                 dd:DragDrop.IsDropTarget="True">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid
                          Width="842"
                          Height="105.92" HorizontalAlignment="Left">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="102" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto"
                                              MinWidth="33" />
                            <ColumnDefinition Width="Auto"
                                              MinWidth="68.828" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto"
                                           MinHeight="15.96" />
                            <RowDefinition Height="0*" />
                        </Grid.RowDefinitions>

                        <!--ProgramPath-->
                        <TextBlock Text="{Binding Name}"
                                   Margin="0,7,10,4" />
                        <TextBox Margin="3,3,14.211,3"
                                 Grid.Row="0"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding ProgramPath, UpdateSourceTrigger=PropertyChanged}"
                                 Tag="{Binding Name}" />

                        <!--Options-->
                        <TextBlock Text="Options"
                                   Margin="0,7,10,3"
                                   Grid.Row="1" />
                        <TextBox x:Name="txtOptions"
                                 Margin="3,3,14.211,3"
                                 Grid.Row="1"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding Options, UpdateSourceTrigger=PropertyChanged}" />

                        <!--btnBrows-->
                        <Button x:Name="btnBrows"
                                Grid.Column="2"
                                VerticalAlignment="Top"
                                Margin="0,3,0,0"
                                Height="25"
                                Content="..."
                                Tag="{Binding}"
                                CommandParameter="{Binding SelectedItem, ElementName=listBox}"
                                Command="{Binding DataContext.Brows, ElementName=listBox}"
                                RenderTransformOrigin="-0.553,0.386"
                                HorizontalAlignment="Left"
                                Width="22.29"
                                Visibility="Collapsed" />
                        <!--Add Or Remove-->
                        <StackPanel Grid.Column="3"
                                    HorizontalAlignment="Stretch"
                                    Height="28"
                                    Margin="0"
                                    Grid.RowSpan="1"
                                    VerticalAlignment="Top"
                                    Width="Auto"
                                    Orientation="Horizontal">
                            <Button x:Name="btBrows"
                                    Content="..."
                                    Margin="0,0,10,0"
                                    ToolTip="Brows..."
                                    Height="20"
                                    Tag="{Binding}"
                                    Command="{Binding DataContext.Brows, ElementName=listBox}"
                                    CommandParameter="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}" Style="{DynamicResource AccentedSquareButtonStyle}"/>
                            <Button x:Name="btnAdd"
                                    Content="+"
                                    Margin="0,0,5,0"
                                    Height="20"
                                    Tag="{Binding}"
                                    Command="{Binding DataContext.Add, ElementName=listBox}"
                                    CommandParameter="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}" VerticalContentAlignment="Top" 
									Style="{DynamicResource AccentedSquareButtonStyle}"/>
                            <Button x:Name="btnDelete"
                                    Content="-"
                                    Margin="0"
                                    Height="20"
                                    Tag="{Binding}"
                                    Command="{Binding DataContext.Delete, ElementName=listBox}"
                                    CommandParameter="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}" Style="{DynamicResource AccentedSquareButtonStyle}"/>

                        </StackPanel>

                        <!--Bottun Name-->
                        <TextBlock x:Name="Bottun_Name"
                                   HorizontalAlignment="Left"
                                   TextWrapping="Wrap"
                                   Text="Bottun Name"
                                   VerticalAlignment="Top"
                                   Grid.Row="2"
                                   Height="15.96"
                                   Width="87.96"
                                   Margin="0,7,0,0" />
                        <TextBox x:Name="txtButtonName"
                                 Margin="3,0,14.211,0"
                                 Grid.Row="2"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding Name, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" />

                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
